package com.service.screenWeb.service.impl;

import com.service.screenWeb.entity.AssemblyConfigure;
import com.service.screenWeb.dao.AssemblyConfigureDao;
import com.service.screenWeb.service.AssemblyConfigureService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 组件单独配置表(AssemblyConfigure)表服务实现类
 *
 * @author makejava
 * @since 2021-05-18 19:56:29
 */
@Service("assemblyConfigureService")
public class AssemblyConfigureServiceImpl implements AssemblyConfigureService {
    @Resource
    private AssemblyConfigureDao assemblyConfigureDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public AssemblyConfigure queryById(String id) {
        return this.assemblyConfigureDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<AssemblyConfigure> queryAllByLimit(int offset, int limit) {
        return this.assemblyConfigureDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param assemblyConfigure 实例对象
     * @return 实例对象
     */
    @Override
    public AssemblyConfigure insert(AssemblyConfigure assemblyConfigure) {
        this.assemblyConfigureDao.insert(assemblyConfigure);
        return assemblyConfigure;
    }

    /**
     * 修改数据
     *
     * @param assemblyConfigure 实例对象
     * @return 实例对象
     */
    @Override
    public AssemblyConfigure update(AssemblyConfigure assemblyConfigure) {
        this.assemblyConfigureDao.update(assemblyConfigure);
        return this.queryById(assemblyConfigure.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.assemblyConfigureDao.deleteById(id) > 0;
    }

    @Override
    public List<AssemblyConfigure> queryDefault() {
        return assemblyConfigureDao.queryDefault();
    }
}
